<?php
include(dirname(__FILE__).'/../../../includes.php5');

include_once($project_path.'/class/user/user.class.php5');
session_start();
include_once($project_path.'/class/fw/dictionary.class.php5');

userUser::checkSession();

$action=(isset($_GET['action'])?$_GET['action']:'');
switch($action)
{
	case 'display':
		include_once($project_path.'/class/fw/smarty.class.php5');
		$smarty = new fwSmarty();

		$smarty->assign('current_user', $_SESSION['current_user']);
		
		$panel = preg_replace('/[^a-z]/', '', $_GET['panel']);

		echo 'var ajax_return_data = "'.fwConverter::text2JSString($smarty->getContents('user/menu/'.$panel.'.tpl')).'";';
		break;
	case 'select':
		if(!file_exists($project_path.'/view/action/'.$_GET['menu'].'/'.$_GET['submenu'].'.menu.php5'))
		{
			echo 'var ajax_return_data ="«!MENU_ERROR_ACTIONUNKNOWN»";'; 
		}
		else
		{
			include_once($project_path.'/class/fw/smarty.class.php5');
			$smarty = new fwSmarty();
			include_once($project_path.'/view/action/'.$_GET['menu'].'/'.$_GET['submenu'].'.menu.php5');

			echo 'var ajax_return_data = "'.fwConverter::text2JSString($smarty->getContents($_GET['menu'].'/'.$_GET['submenu'].'.tpl')).'";';
		}
		break;
}
?>